/*
@Time : 2021/1/31 4:31 下午
@Author : wujianping
@File : string
@Software: GoLand
*/
package xstring

import (
	"encoding/json"
	"fmt"
	"git.xycm.com/pkg/xsnowflake"
)

func RandName(name string) string {
	return fmt.Sprintf("%s%s", name, xsnowflake.GetSnowflakeId())
}

func StructToString(data interface{}) string {
	var str string
	jsons, err := json.Marshal(data)
	if err != nil {
		str = ""
	} else {
		str = string(jsons)
	}

	return str
}
